package fun.yyds.controller.file;

import fun.yyds.common.ResponseData;
import fun.yyds.service.file.FileService;

import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.tags.Tag;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.multipart.MultipartFile;

import javax.annotation.Resource;
import java.util.List;

/**
 * @description: File
 * @author: Chensn
 * @time: 2024/10/31
 */
@RestController
@Tag(name  = "3.File")
@RequestMapping("/file")
public class FileController {
    @Resource
    private FileService fileService;

    @PostMapping("/upload")
    @Operation(summary ="文件上传")
    public ResponseData FileUpload(List<MultipartFile> files) {
        return ResponseData.success(fileService.fileUpload(files));
    }

    @GetMapping("/list")
    @Operation(summary ="文件列表")
    public ResponseData FileList() {
        return ResponseData.success(fileService.fileList());
    }

    @PutMapping("/download")
    @Operation(summary ="文件下载")
    public ResponseData FileDownload() {
        return ResponseData.success(fileService.fileDownload());
    }


    @DeleteMapping("/delete")
    @Operation(summary ="文件删除")
    public ResponseData FileDelete() {
        return ResponseData.success(fileService.fileDelete());
    }
}
